<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
      <el-form-item label="预算名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入预算名称"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="预算年度" prop="year">
        <el-date-picker
          v-model="queryParams.year"
          value-format="yyyy"
          type="year"
          placeholder="选择预算年度">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="审核状态" prop="state">
        <el-select
          v-model="queryParams.state"
          clearable
          placeholder="请选择审核状态"
        >
          <el-option
            v-for="dict in budgetStatus"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['budget:budget:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          icon="el-icon-download"
          size="mini"
          type="warning"
          :disabled="multiple"
          @click="handleExport"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="BudgetFundsList" @selection-change="handleSelectionChange">
<!--            <el-table-column type="selection" width="55" align="center" :selectable='checkboxT'/>-->
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column fixed label="预算编号" min-width="200" align="center" prop="number"/>
      <el-table-column fixed label="预算单位" min-width="130" align="center" prop="deptName"/>
      <el-table-column label="预算名称" min-width="200" align="center" prop="name"/>
      <el-table-column label="预算年份" align="center" prop="year"/>
      <el-table-column label="面积（亩）" min-width="100" align="center" prop="zmj"/>
      <el-table-column label="预算金额（元）" min-width="130" align="center" prop="totalMoney">
        <template slot-scope="scope">
          <span>
            <!--{{
              scope.row.totalMoney == 0 ? "-" : (String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.totalMoney).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.totalMoney).split('.')[1].length < 2 ? String(scope.row.totalMoney).split('.')[1] + '0' : String(scope.row.totalMoney).split('.')[1]))
            }}-->
            {{ (parseFloat(scope.row.statis.gytdprice)+parseFloat(scope.row.statis.jttdprice)+parseFloat(scope.row.statis.qmprice)+parseFloat(scope.row.statis.fswprice))==0?"-":String((parseFloat(scope.row.statis.gytdprice)+parseFloat(scope.row.statis.jttdprice)+parseFloat(scope.row.statis.qmprice)+parseFloat(scope.row.statis.fswprice)).toFixed(2)).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')+"."+String((parseFloat(scope.row.statis.gytdprice)+parseFloat(scope.row.statis.jttdprice)+parseFloat(scope.row.statis.qmprice)+parseFloat(scope.row.statis.fswprice)).toFixed(2)).split('.')[1]
            }}

            <!--{{scope.row.statis==null?'-':
              ((scope.row.statis.gytdprice==null||scope.row.statis.gytdprice==''?0:parseFloat(scope.row.statis.gytdprice))+ (scope.row.statis.jttdprice==null||scope.row.statis.jttdprice==''?0:parseFloat(scope.row.statis.jttdprice))+(scope.row.statis.qmprice==null||scope.row.statis.qmprice==''?0:parseFloat(scope.row.statis.qmprice))+(scope.row.statis.fswprice==null||scope.row.statis.fswprice==''?0:parseFloat(scope.row.statis.fswprice))) == 0 ? "-" : (String(((scope.row.statis.gytdprice==null||scope.row.statis.gytdprice==''?0:parseFloat(scope.row.statis.gytdprice))+ (scope.row.statis.jttdprice==null||scope.row.statis.jttdprice==''?0:parseFloat(scope.row.statis.jttdprice))+(scope.row.statis.qmprice==null||scope.row.statis.qmprice==''?0:parseFloat(scope.row.statis.qmprice))+(scope.row.statis.fswprice==null||scope.row.statis.fswprice==''?0:parseFloat(scope.row.statis.fswprice)))).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(((scope.row.statis.gytdprice==null||scope.row.statis.gytdprice==''?0:parseFloat(scope.row.statis.gytdprice))+ (scope.row.statis.jttdprice==null||scope.row.statis.jttdprice==''?0:parseFloat(scope.row.statis.jttdprice))+(scope.row.statis.qmprice==null||scope.row.statis.qmprice==''?0:parseFloat(scope.row.statis.qmprice))+(scope.row.statis.fswprice==null||scope.row.statis.fswprice==''?0:parseFloat(scope.row.statis.fswprice)))).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(((scope.row.statis.gytdprice==null||scope.row.statis.gytdprice==''?0:parseFloat(scope.row.statis.gytdprice))+ (scope.row.statis.jttdprice==null||scope.row.statis.jttdprice==''?0:parseFloat(scope.row.statis.jttdprice))+(scope.row.statis.qmprice==null||scope.row.statis.qmprice==''?0:parseFloat(scope.row.statis.qmprice))+(scope.row.statis.fswprice==null||scope.row.statis.fswprice==''?0:parseFloat(scope.row.statis.fswprice)))).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(((scope.row.statis.gytdprice==null||scope.row.statis.gytdprice==''?0:parseFloat(scope.row.statis.gytdprice))+ (scope.row.statis.jttdprice==null||scope.row.statis.jttdprice==''?0:parseFloat(scope.row.statis.jttdprice))+(scope.row.statis.qmprice==null||scope.row.statis.qmprice==''?0:parseFloat(scope.row.statis.qmprice))+(scope.row.statis.fswprice==null||scope.row.statis.fswprice==''?0:parseFloat(scope.row.statis.fswprice)))).split('.')[1].length < 2 ? String(((scope.row.statis.gytdprice==null||scope.row.statis.gytdprice==''?0:parseFloat(scope.row.statis.gytdprice))+ (scope.row.statis.jttdprice==null||scope.row.statis.jttdprice==''?0:parseFloat(scope.row.statis.jttdprice))+(scope.row.statis.qmprice==null||scope.row.statis.qmprice==''?0:parseFloat(scope.row.statis.qmprice))+(scope.row.statis.fswprice==null||scope.row.statis.fswprice==''?0:parseFloat(scope.row.statis.fswprice)))).split('.')[1] + '0' : String(((scope.row.statis.gytdprice==null||scope.row.statis.gytdprice==''?0:parseFloat(scope.row.statis.gytdprice))+ (scope.row.statis.jttdprice==null||scope.row.statis.jttdprice==''?0:parseFloat(scope.row.statis.jttdprice))+(scope.row.statis.qmprice==null||scope.row.statis.qmprice==''?0:parseFloat(scope.row.statis.qmprice))+(scope.row.statis.fswprice==null||scope.row.statis.fswprice==''?0:parseFloat(scope.row.statis.fswprice)))).split('.')[1]))
          }}-->

    <!--          {{ ((scope.row.statis.gytdprice==null||scope.row.statis.gytdprice==''?0:parseFloat(scope.row.statis.gytdprice))+ (scope.row.statis.jttdprice==null||scope.row.statis.jttdprice==''?0:parseFloat(scope.row.statis.jttdprice))+(scope.row.statis.qmprice==null||scope.row.statis.qmprice==''?0:parseFloat(scope.row.statis.qmprice))+(scope.row.statis.fswprice==null||scope.row.statis.fswprice==''?0:parseFloat(scope.row.statis.fswprice)))}}-->
           </span>
        </template>
      </el-table-column>
      <!--<el-table-column label="国有土地" align="center">
        <el-table-column
          align="center"
          prop="statis.gytdmj"
          label="面积（亩）"
          width="120">
          <template slot-scope="scope">
            <div>{{ scope.row.statis.gytdmj == 0 ? "-" : scope.row.statis.gytdmj }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="statis.gytdprice"
          label="金额（元）"
          width="120">
          <template slot-scope="scope">
            <div>
              {{
                scope.row.statis.gytdprice == 0 ? "-" : (String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
              }}
            </div>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="集体土地" align="center">
        <el-table-column
          align="center"
          prop="statis.jttdmj"
          label="面积（亩）"
          width="120">
          <template slot-scope="scope">
            <div>{{ scope.row.statis.jttdmj == 0 ? "-" : scope.row.statis.jttdmj }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="statistics.jtTotalPrice"
          label="金额（元）"
          width="120">
          <template slot-scope="scope">
            <div> {{
                scope.row.statis.jttdprice == 0 ? "-" : (String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
              }}
            </div>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="附着物" align="center">
        <el-table-column
          align="center"
          prop="statis.qmmj"
          label="面积（亩）"
          width="120">
          <template slot-scope="scope">
            <div>{{ scope.row.statis.qmmj == 0 ? "-" : scope.row.statis.qmmj }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="statis.qmprice"
          label="金额（元）"
          width="120">
          <template slot-scope="scope">
            <div style="line-height: 23px; text-align: left;" v-show="scope.row.statis.qmprice !=0">
              {{
                scope.row.statis.qmprice == 0 ? "-" : (String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
              }}
            </div>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="地上附属物" align="center">
        <el-table-column
          align="center"
          prop="statis.fswmj"
          label="面积（亩）"
          width="120">
          <template slot-scope="scope">
            <div>{{ scope.row.statis.fswmj == 0 ? "-" : scope.row.statis.fswmj }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="statis.fswprice"
          label="金额（元）"
          width="120">
          <template slot-scope="scope">
            <div style="line-height: 23px; text-align: center;">
              {{
                scope.row.statis.fswprice == 0 ? "-" : (String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
              }}
            </div>
          </template>
        </el-table-column>
      </el-table-column>-->
      <el-table-column label="地块数" min-width="80" align="center" prop="statis.dkzs"/>
      <el-table-column label="审核状态" min-width="90" align="center" phandleExportrop="state">
        <template slot-scope="scope">
          <div class="statusDv">
            <div class="statudPoint" :class="'Bg'+scope.row['state']"></div>
            <div v-for="sta in budgetStatus" v-if="sta.dictValue == scope.row['state']">{{ sta.dictLabel }}</div>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="备注" min-width="270" align="center" prop="aa">
        <template slot-scope="scope">
          <div v-if="scope.row.statis!=null">
          <div align="left" v-if="scope.row.statis.gytdmj!=null&&scope.row.statis.gytdmj!=''"> {{"国有土地 （面积："+scope.row.statis.gytdmj +"金额："+
          (scope.row.statis.gytdprice == 0 ? "-" : (String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.gytdprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.gytdprice).split('.')[1].length < 2 ? String(scope.row.statis.gytdprice).split('.')[1] + "0" : String(scope.row.statis.gytdprice).split('.')[1])))+"）"}}</div>
          <div align="left" v-if="scope.row.statis.jttdmj!=null&&scope.row.statis.jttdmj!=''"> {{'集体土地 （面积：'+scope.row.statis.jttdmj +" 金额："+
          (scope.row.statis.jttdprice == 0 ? "-" : (String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.jttdprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.jttdprice).split('.')[1].length < 2 ? String(scope.row.statis.jttdprice).split('.')[1] + '0' : String(scope.row.statis.jttdprice).split('.')[1])))+"）"}}</div>
          <div align="left" v-if="scope.row.statis.qmmj!=null&&scope.row.statis.qmmj!=''"> {{'青 苗  （面积：'+scope.row.statis.qmmj +' 金额：'+
          (scope.row.statis.qmprice == 0 ? "-" : (String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.qmprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.qmprice).split('.')[1].length < 2 ? String(scope.row.statis.qmprice).split('.')[1] + '0' : String(scope.row.statis.qmprice).split('.')[1])))+"）"}}</div>
          <div align="left" v-if="scope.row.statis.fswmj!=null&&scope.row.statis.fswmj!=''"> {{'地上附属物  （面积：'+scope.row.statis.fswmj +' 金额：'+
          (scope.row.statis.fswprice == 0 ? "-" : (String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.fswprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.fswprice).split('.')[1].length < 2 ? String(scope.row.statis.fswprice).split('.')[1] + '0' : String(scope.row.statis.fswprice).split('.')[1])))+"）"}}</div>
          </div>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" min-width="200">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleTabDetails(scope.row)"
          >
            <svg-icon class="svg" icon-class="details"/>
            预算明细
          </el-button>
          <el-button
            v-if="scope.row.state=='0'"
            size="mini"
            type="text"
            @click="handleSubmit(scope.row)"
            v-hasPermi="['budget:budget:submit']"
          >
            <svg-icon class="svg" icon-class="guide"/>
            复核提交
          </el-button>
<!--          v-if="(scope.row.state=='0'||scope.row.state=='3')&&scope.row.by1!='2'"-->

          <el-button
            v-if="(scope.row.state=='0'||scope.row.state=='3')"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['budget:budget:edit1']"
          >修改
          </el-button>

          <!-- <el-button
             size="mini"
             type="text"
             v-if="scope.row.departmentCode.length<12"
             @click="handleTabDetails(scope.row)"
           >
             <svg-icon class="svg" icon-class="details"/>
             预算明细
           </el-button>-->
          <el-button
            v-if="scope.row.state!='1'"
            size="mini"
            type="text"
            @click="handleExamineRecord(scope.row)"
          >
            <svg-icon class="svg" icon-class="records"/>
            审核记录
          </el-button>
          <el-button
            v-if="scope.row.state!='1'"
            size="mini"
            type="text"
            @click="handleOperationLog(scope.row)"
          >            <svg-icon class="svg" icon-class="details"/>
            操作日志
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- <el-button
                v-if="scope.row.by1=='0'"
                size="mini"
                type="text"
                @click="handlecbfDetails(scope.row)"
              >
                <svg-icon class="svg" icon-class="details"/>
                预算明细
              </el-button>
              <el-button
                v-else
                size="mini"
                type="text"
                @click="handleDetails(scope.row)"
              >
                <svg-icon class="svg" icon-class="details"/>
                预算明细
              </el-button>-->
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body @close="cancel">
      <el-steps :active="active" finish-status="success" align-center style="margin-bottom: 20px">
        <el-step title="填写信息"></el-step>
        <el-step title="明细信息"></el-step>
        <el-step title="汇总信息"></el-step>
      </el-steps>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px" v-if="active == 0">
        <el-form-item label="预算年度" prop="year">
          <el-date-picker
            style="width: 100%"
            v-model="form.year"
            value-format="yyyy"
            type="year"
            disabled
            placeholder="选择预算年度">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="预算编号" prop="number">
          <el-input v-model="form.number" placeholder="请输入预算编号" disabled/>
        </el-form-item>
        <el-form-item label="预算单位" prop="departmentCode">
          <el-select
            style="width: 100%"
            v-model="form.departmentName"
            multiple
            @change="selectDept"
            placeholder="请选择">
            <el-option
              v-for="item in this.villageData"
              :key="item.deptCode"
              :label="item.deptName"
              :value="item.deptCode">
            </el-option>
          </el-select>
          <el-input v-show="1==2" v-model="form.departmentCode" placeholder="请输入预算编号"/>
        </el-form-item>

        <el-form-item label="预算名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入预算名称"/>
        </el-form-item>
      <!--  <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容"/>
        </el-form-item>-->
      </el-form>
      <div v-else-if="active == 1">
        <el-form :model="querypgParams" ref="querypgForm" :inline="true" v-show="showSearch">
          <el-form-item label="村" prop="departmentCode">
            <el-select
              v-model="querypgParams.departmentCode"
              clearable
              placeholder="请选择村"
              style="width: 120px"
            >
              <el-option
                v-for="item in this.villageData"
                :key="item.deptCode"
                :label="item.deptName"
                :value="item.deptCode">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="承包方" prop="cbfmc">
            <el-input
              v-model="querypgParams.cbfmc"
              placeholder="请输入承包方"
              clearable
              size="small"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="cyan" icon="el-icon-search" size="mini" @click="handlePgQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetPgQuery">重置</el-button>
          </el-form-item>
        </el-form>
        <el-table v-loading="loading" :data="pgList" @selection-change="handleSelectionChange">
          <el-table-column width="220" label="行政区划" align="center" prop="county">
            <template slot-scope="scope">
              {{ scope.row.county }} - {{ scope.row.township }} - {{ scope.row.village }}
            </template>
          </el-table-column>
          <!--<el-table-column label="县区" width="60" align="center" prop="county"/>
          <el-table-column label="乡镇" width="80" align="center" prop="township"/>
          <el-table-column label="村" width="120" align="center" prop="village"/>-->
          <el-table-column label="承包方" align="center" prop="cbfmc"/>
          <el-table-column label="地块编码" width="180" align="center" prop="dkbm"/>
          <el-table-column label="评估项" width="120" align="center" prop="itemName"/>
          <el-table-column label="面积（亩）" width="90" align="center" prop="evaluationArea"/>
          <el-table-column label="评估价（元）" width="120" align="center" prop="price">
            <template slot-scope="scope">
              {{
                scope.row.price == 0 ? "-" : (String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.price).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.price).split('.')[1].length < 2 ? String(scope.row.price).split('.')[1] + '0' : String(scope.row.price).split('.')[1]))
              }}
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="pgtotal>0"
          :total="pgtotal"
          :page.sync="querypgParams.pageNum"
          :limit.sync="querypgParams.pageSize"
          @pagination="getPgList"
        />
      </div>
      <div v-else-if="active == 2">
        <div style="min-height: 450px;">
          <el-table v-loading="loading" :data="pghzList" @selection-change="handleSelectionChange">
            <el-table-column fixed width="220" label="机构名称" align="center" prop="county">
              <template slot-scope="scope">
                {{ scope.row.cjname }}
              </template>
            </el-table-column>
            <el-table-column label="总面积" width="100" align="center" prop="qmmj">
              <template slot-scope="scope">
                {{ (parseInt(scope.row.gytdmj * 10000) + parseInt(scope.row.jttdmj * 10000)) / 10000 }}
              </template>
            </el-table-column>
            <el-table-column label="预算金额" width="100" align="center" prop="qmmj">
              <template slot-scope="scope">
                {{
                  (parseFloat(scope.row.gytdprice)+parseFloat(scope.row.jttdprice)+parseFloat(scope.row.qmprice)+parseFloat(scope.row.fswprice)) == 0 ? "-" : (String((parseFloat(scope.row.gytdprice)+parseFloat(scope.row.jttdprice)+parseFloat(scope.row.qmprice)+parseFloat(scope.row.fswprice))).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String((parseFloat(scope.row.gytdprice)+parseFloat(scope.row.jttdprice)+parseFloat(scope.row.qmprice)+parseFloat(scope.row.fswprice))).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String((parseFloat(scope.row.gytdprice)+parseFloat(scope.row.jttdprice)+parseFloat(scope.row.qmprice)+parseFloat(scope.row.fswprice))).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String((parseFloat(scope.row.gytdprice)+parseFloat(scope.row.jttdprice)+parseFloat(scope.row.qmprice)+parseFloat(scope.row.fswprice))).split('.')[1].length < 2 ? String((parseFloat(scope.row.gytdprice)+parseFloat(scope.row.jttdprice)+parseFloat(scope.row.qmprice)+parseFloat(scope.row.fswprice))).split('.')[1] + '0' : String((parseFloat(scope.row.gytdprice)+parseFloat(scope.row.jttdprice)+parseFloat(scope.row.qmprice)+parseFloat(scope.row.fswprice))).split('.')[1]))
                }}
              </template>
            </el-table-column>
            <el-table-column label="地块数" align="center" prop="dkzs"/>
            <el-table-column label="备注" min-width="270" align="center" prop="aa">
              <template slot-scope="scope">
                <div align="left" v-if="scope.row.gytdprice!=null&&scope.row.gytdprice!=''&&scope.row.gytdprice!=0">
                  {{ '国有土地 （面积：' + scope.row.gytdmj + ' 金额：' + (scope.row.gytdprice == 0 ? "-" : (String(scope.row.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.gytdprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.gytdprice).split('.')[1].length < 2 ? String(scope.row.gytdprice).split('.')[1] + "0" : String(scope.row.gytdprice).split('.')[1]))) + "）" }}
                </div>
                <div align="left" v-if="scope.row.jttdmj!=null&&scope.row.jttdmj!=''&&scope.row.jttdmj!=0"> {{
                    '集体土地 （面积：' + scope.row.jttdmj + " 金额：" +
                    (scope.row.jttdprice == 0 ? "-" : (String(scope.row.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.jttdprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.jttdprice).split('.')[1].length < 2 ? String(scope.row.jttdprice).split('.')[1] + '0' : String(scope.row.jttdprice).split('.')[1]))) + "）"
                  }}
                </div>
                <div align="left" v-if="scope.row.qmmj!=null&&scope.row.qmmj!=''&&scope.row.qmmj!=0"> {{
                    '青 苗  （面积：' + scope.row.qmmj + ' 金额：' +
                    (scope.row.qmprice == 0 ? "-" : (String(scope.row.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.qmprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.qmprice).split('.')[1].length < 2 ? String(scope.row.qmprice).split('.')[1] + '0' : String(scope.row.qmprice).split('.')[1]))) + "）"
                  }}
                </div>
                <div align="left" v-if="scope.row.fswmj!=null&&scope.row.fswmj!=''&&scope.row.fswmj!=0"> {{
                    '地上附属物  （面积：' + scope.row.fswmj + ' 金额：' +
                    (scope.row.fswprice == 0 ? "-" : (String(scope.row.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.fswprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.fswprice).split('.')[1].length < 2 ? String(scope.row.fswprice).split('.')[1] + '0' : String(scope.row.fswprice).split('.')[1]))) + "）"
                  }}
                </div>
              </template>
            </el-table-column>
          </el-table>




         <!-- <el-table v-loading="loading" :data="pghzList" @selection-change="handleSelectionChange">
            &lt;!&ndash;   <el-table-column label="县区" width="60" align="center" prop="xjname"/>
               <el-table-column label="乡镇" width="80" align="center" prop="zjname"/>&ndash;&gt;
            <el-table-column fixed label="机构名称" width="120" align="center" prop="deptName"/>
            &lt;!&ndash;<el-table-column label="国有土地" align="center">
              <el-table-column
                align="center"
                prop="statis.gytdmj"
                label="面积（亩）"
                width="120">
                <template slot-scope="scope">
                  <div>{{ scope.row.statis.gytdmj == 0 ? "-" : scope.row.statis.gytdmj }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                align="center"
                prop="statis.gytdprice"
                label="金额（元）"
                width="120">
                <template slot-scope="scope">
                  <div>
                    {{
                      scope.row.statis.gytdprice == 0 ? "-" : (String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                    }}
                  </div>
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column label="集体土地" align="center">
              <el-table-column
                align="center"
                prop="statis.jttdmj"
                label="面积（亩）"
                width="120">
                <template slot-scope="scope">
                  <div>{{ scope.row.statis.jttdmj == 0 ? "-" : scope.row.statis.jttdmj }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                align="center"
                prop="statis.jttdprice"
                label="金额（元）"
                width="120">
                <template slot-scope="scope">
                  <div> {{
                      scope.row.statis.jttdprice == 0 ? "-" : (String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                    }}
                  </div>
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column label="附着物" align="center">
              <el-table-column
                align="center"
                prop="statis.qmmj"
                label="面积（亩）"
                width="120">
                <template slot-scope="scope">
                  <div>{{ scope.row.statis.qmmj == 0 ? "-" : scope.row.statis.qmmj }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                align="center"
                prop="statis.qmprice"
                label="金额（元）"
                width="120">
                <template slot-scope="scope">
                  <div style="line-height: 23px; text-align: left;" v-show="scope.row.statis.qmprice !=0">
                    {{
                      scope.row.statis.qmprice == 0 ? "-" : (String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                    }}
                  </div>
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column label="地上附属物" align="center">
              <el-table-column
                align="center"
                prop="statis.fswmj"
                label="面积（亩）"
                width="120">
                <template slot-scope="scope">
                  <div>{{ scope.row.statis.fswmj == 0 ? "-" : scope.row.statis.fswmj }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                align="center"
                prop="statis.fswprice"
                label="金额（元）"
                width="120">
                <template slot-scope="scope">
                  <div style="line-height: 23px; text-align: center;">
                    {{
                      scope.row.statis.fswprice == 0 ? "-" : (String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                    }}
                  </div>
                </template>
              </el-table-column>
            </el-table-column>&ndash;&gt;
            <el-table-column label="地块数" min-width="80" align="center" prop="statis.dkzs"/>
            <el-table-column label="总面积（亩）" min-width="100" align="center" prop="zmj">
              <template slot-scope="scope">
                {{ (parseInt(scope.row.statis.gytdmj * 100) + parseInt(scope.row.statis.jttdmj * 100)) / 100 }}
              </template>
            </el-table-column>
            <el-table-column label="预算金额（元）" min-width="120" align="center" prop="totalMoney">
              <template slot-scope="scope">
                {{
                  scope.row.totalMoney == 0 ? "-" : (String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.totalMoney).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.totalMoney).split('.')[1].length < 2 ? String(scope.row.totalMoney).split('.')[1] + '0' : String(scope.row.totalMoney).split('.')[1]))
                }}
              </template>
            </el-table-column>
            <el-table-column label="备注" min-width="270" align="center" prop="aa">
              <template slot-scope="scope">
                <div align="left" v-if="scope.row.statis.gytdmj!=null&&scope.row.statis.gytdmj!=''"> {{"国有土地 （面积："+scope.row.statis.gytdmj +"金额："+
                (scope.row.statis.gytdprice == 0 ? "-" : (String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.gytdprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.gytdprice).split('.')[1].length < 2 ? String(scope.row.statis.gytdprice).split('.')[1] + "0" : String(scope.row.statis.gytdprice).split('.')[1])))+"）"}}</div>
                <div align="left" v-if="scope.row.statis.jttdmj!=null&&scope.row.statis.jttdmj!=''"> {{'集体土地 （面积：'+scope.row.statis.jttdmj +" 金额："+
                (scope.row.statis.jttdprice == 0 ? "-" : (String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.jttdprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.jttdprice).split('.')[1].length < 2 ? String(scope.row.statis.jttdprice).split('.')[1] + '0' : String(scope.row.statis.jttdprice).split('.')[1])))+"）"}}</div>
                <div align="left" v-if="scope.row.statis.qmmj!=null&&scope.row.statis.qmmj!=''"> {{'青 苗  （面积：'+scope.row.statis.qmmj +' 金额：'+
                (scope.row.statis.qmprice == 0 ? "-" : (String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.qmprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.qmprice).split('.')[1].length < 2 ? String(scope.row.statis.qmprice).split('.')[1] + '0' : String(scope.row.statis.qmprice).split('.')[1])))+"）"}}</div>
                <div align="left" v-if="scope.row.statis.fswmj!=null&&scope.row.statis.fswmj!=''"> {{'青 苗  （面积：'+scope.row.statis.fswmj +' 金额：'+
                (scope.row.statis.fswprice == 0 ? "-" : (String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.fswprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.fswprice).split('.')[1].length < 2 ? String(scope.row.statis.fswprice).split('.')[1] + '0' : String(scope.row.statis.fswprice).split('.')[1])))+"）"}}</div>
              </template>
            </el-table-column>
          </el-table>-->
        </div>
        <pagination
          v-show="pghztotal>0"
          :total="pghztotal"
          :page.sync="querypghzParams.pageNum"
          :limit.sync="querypghzParams.pageSize"
          @pagination="getPghzList"
        />
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" plain @click="pres" v-if="active == 1||active == 2">上一步</el-button>
        <el-button type="success" plain @click="next" v-if="active == 0||active == 1">下一步</el-button>
        <el-button type="success" plain @click="submitForm" v-if="active == 2">完成</el-button>
      </div>
    </el-dialog>
    <!--<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body @close="cancel">
      <el-steps :active="active" finish-status="success" align-center style="margin-bottom: 20px">
        <el-step title="填写信息"></el-step>
        <el-step title="步骤 2"></el-step>
      </el-steps>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px" v-if="active == 0">
        <el-form-item label="预算年度" prop="year">
          <el-date-picker
            style="width: 100%"
            v-model="form.year"
            value-format="yyyy"
            type="year"
            placeholder="选择预算年度">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="预算单位" prop="departmentName">
          <el-select
            style="width: 100%"
            v-model="form.departmentName"
            multiple
            @change="selectDept"
            placeholder="请选择">
            <el-option
              v-for="item in this.villageData"
              :key="item.deptCode"
              :label="item.deptName"
              :value="item.deptCode">
            </el-option>
          </el-select>
          &lt;!&ndash;          <el-input v-show="1==2" v-model="form.departmentCode" placeholder="请输入预算编号"/>&ndash;&gt;
        </el-form-item>
        <el-form-item label="预算编号" prop="number">
          <el-input v-model="form.number" placeholder="请输入预算编号" readonly/>
        </el-form-item>
        <el-form-item label="预算名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入预算名称"/>
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
      </el-form>
      <div v-else>
        <el-form :model="querypgParams" ref="querypgForm" :inline="true" v-show="showSearch">
          <el-form-item label="村" prop="departmentCode">
            <el-select
              v-model="querypgParams.departmentCode"
              clearable
              placeholder="请选择村"
              style="width: 120px"
            >
              <el-option
                v-for="item in this.villageData"
                :key="item.deptCode"
                :label="item.deptName"
                :value="item.deptCode">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="承包方" prop="cbfmc">
            <el-input
              v-model="querypgParams.cbfmc"
              placeholder="请输入承包方"
              clearable
              size="small"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="cyan" icon="el-icon-search" size="mini" @click="handlePgQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetPgQuery">重置</el-button>
          </el-form-item>
        </el-form>
        <el-table v-loading="loading" :data="pgList" @selection-change="handleSelectionChange">
          <el-table-column width="220" label="行政区划" align="center" prop="county">
            <template slot-scope="scope">
              {{ scope.row.county }} - {{ scope.row.township }} - {{ scope.row.village }}
            </template>
          </el-table-column>
          &lt;!&ndash;<el-table-column label="县区" align="center" prop="county"/>
          <el-table-column label="乡镇" align="center" prop="township"/>
          <el-table-column label="村" align="center" prop="village"/>&ndash;&gt;
          <el-table-column label="承包方" align="center" prop="cbfmc"/>
          <el-table-column label="地块编码" align="center" prop="dkbm"/>
          <el-table-column label="附着物" align="center" prop="itemName"/>
          <el-table-column label="面积（亩）" align="center" prop="evaluationArea"/>
          <el-table-column label="评估价（元）" align="center" prop="price">
            <template slot-scope="scope">
              {{
                scope.row.price == 0 ? "-" : (String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
              }}
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="pgtotal>0"
          :total="pgtotal"
          :page.sync="querypgParams.pageNum"
          :limit.sync="querypgParams.pageSize"
          @pagination="getPgList"
        />
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="pres" v-if="active == 1">上一步</el-button>
        <el-button type="primary" @click="next" v-if="active == 0">下一步</el-button>
        <el-button type="success" @click="submitForm" v-if="active == 1">完成</el-button>
      </div>
    </el-dialog>-->

    <el-dialog title="预算明细" :visible.sync="openTabYsmx" width="1000px" append-to-body>
      <el-tabs type="border-card">
        <el-tab-pane label="明细信息">
          <div style="min-height: 450px;">
            <el-form :model="querybudgetFundsParams" ref="querybudgetFundsForm" :inline="true" v-show="showSearch">
              <el-form-item label="县区" prop="city" v-show="cityShow">
                <el-select
                  v-model="querybudgetFundsParams.city"
                  clearable
                  placeholder="请选择"
                  size="small"
                  @change="selectCity"
                >
                  <el-option
                    v-for="item in this.cityData"
                    :key="item.deptCode"
                    :label="item.deptName"
                    :value="item.deptCode">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="乡镇" prop="town" v-show="townShow">
                <el-select
                  v-model="querybudgetFundsParams.town"
                  clearable
                  placeholder="请选择"
                  size="small"
                  @change="selectTown"
                >
                  <el-option
                    v-for="item in this.townData"
                    :key="item.deptCode"
                    :label="item.deptName"
                    :value="item.deptCode">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="村" prop="village" v-show="villageShow">
                <el-select
                  v-model="querybudgetFundsParams.village"
                  clearable
                  placeholder="请选择"
                  size="small"
                  @change="selectVillage"
                >
                  <el-option
                    v-for="item in this.villageData"
                    :key="item.deptCode"
                    :label="item.deptName"
                    :value="item.deptCode">
                  </el-option>
                </el-select>
              </el-form-item>


              <!--<el-form-item label="村" prop="departmentCode">
                <el-select
                  v-model="querybudgetFundsParams.departmentCode"
                  clearable
                  placeholder="请选择村"
                  style="width: 120px"
                >
                  <el-option
                    v-for="item in this.villageData"
                    :key="item.deptCode"
                    :label="item.deptName"
                    :value="item.deptCode">
                  </el-option>
                </el-select>
              </el-form-item>-->
              <el-form-item label="承包方" prop="cbfmc">
                <el-input
                  v-model="querybudgetFundsParams.cbfmc"
                  placeholder="请输入承包方"
                  clearable
                  size="small"
                />
              </el-form-item>
              <el-form-item>
                <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleDetailsQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetDetailsQuery">重置</el-button>
              </el-form-item>
            </el-form>
            <el-table v-loading="loading" :data="detailsList" @selection-change="handleSelectionChange">
              <el-table-column width="220" label="行政区划" align="center" prop="county">
                <template slot-scope="scope">
                  {{ scope.row.county }} - {{ scope.row.township }} - {{ scope.row.village }}
                </template>
              </el-table-column>
              <!--<el-table-column label="县区" width="50" align="center" prop="county"/>
              <el-table-column label="乡镇" width="80" align="center" prop="township"/>
              <el-table-column label="村" width="100" align="center" prop="village"/>-->
              <el-table-column label="承包方" align="center" prop="cbfmc"/>
              <el-table-column label="地块编码" width="200" align="center" prop="dkbm"/>
              <el-table-column label="面积（亩）" width="90" align="center" prop="evaluationArea"/>
              <el-table-column label="补偿项名称" width="120" align="center" prop="itemName"/>
              <el-table-column label="评估价（元）" width="120" align="center" prop="price">
                <template slot-scope="scope">
                  {{
                    scope.row.price == 0 ? "-" : (String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.price).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.price).split('.')[1].length < 2 ? String(scope.row.price).split('.')[1] + '0' : String(scope.row.price).split('.')[1]))
                  }}
                </template>
              </el-table-column>
            </el-table>
          </div>
          <pagination
            v-show="detailstotal>0"
            :total="detailstotal"
            :page.sync="querybudgetFundsParams.pageNum"
            :limit.sync="querybudgetFundsParams.pageSize"
            @pagination="getDetailsList"
          />
        </el-tab-pane>
        <el-tab-pane label="汇总信息">
          <div style="min-height: 450px;">
            <el-table v-loading="loading" :data="pghzList" @selection-change="handleSelectionChange">
              <!--   <el-table-column label="县区" width="60" align="center" prop="xjname"/>
                 <el-table-column label="乡镇" width="80" align="center" prop="zjname"/>-->
              <el-table-column fixed label="机构名称" min-width="120" align="center" prop="deptName"/>
              <!--<el-table-column label="国有土地" align="center">
                <el-table-column
                  align="center"
                  prop="statis.gytdmj"
                  label="面积（亩）"
                  width="120">
                  <template slot-scope="scope">
                    <div>{{ scope.row.statis.gytdmj == 0 ? "-" : scope.row.statis.gytdmj }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="statis.gytdprice"
                  label="价格（元）"
                  width="120">
                  <template slot-scope="scope">
                    <div>
                      {{
                        scope.row.statis.gytdprice == 0 ? "-" : (String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                      }}
                    </div>
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column label="集体土地" align="center">
                <el-table-column
                  align="center"
                  prop="statis.jttdmj"
                  label="面积（亩）"
                  width="120">
                  <template slot-scope="scope">
                    <div>{{ scope.row.statis.jttdmj == 0 ? "-" : scope.row.statis.jttdmj }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="statis.jttdprice"
                  label="价格（元）"
                  width="120">
                  <template slot-scope="scope">
                    <div> {{
                        scope.row.statis.jttdprice == 0 ? "-" : (String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                      }}
                    </div>
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column label="附着物" align="center">
                <el-table-column
                  align="center"
                  prop="statis.qmmj"
                  label="面积（亩）"
                  width="120">
                  <template slot-scope="scope">
                    <div>{{ scope.row.statis.qmmj == 0 ? "-" : scope.row.statis.qmmj }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="statis.qmprice"
                  label="价格（元）"
                  width="120">
                  <template slot-scope="scope">
                    <div style="line-height: 23px; text-align: left;" v-show="scope.row.statis.qmprice !=0">
                      {{
                        scope.row.statis.qmprice == 0 ? "-" : (String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                      }}
                    </div>
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column label="地上附属物" align="center">
                <el-table-column
                  align="center"
                  prop="statis.fswmj"
                  label="面积（亩）"
                  width="120">
                  <template slot-scope="scope">
                    <div>{{ scope.row.statis.fswmj == 0 ? "-" : scope.row.statis.fswmj }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="statis.fswprice"
                  label="价格（元）"
                  width="120">
                  <template slot-scope="scope">
                    <div style="line-height: 23px; text-align: center;">
                      {{
                        scope.row.statis.fswprice == 0 ? "-" : (String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                      }}
                    </div>
                  </template>
                </el-table-column>
              </el-table-column>-->
              <el-table-column label="地块数" align="center" prop="statis.dkzs"/>
              <el-table-column label="总面积（亩）" align="center" prop="zmj">
                <template slot-scope="scope">
                  {{ sumTotal(scope.row.statis.gytdmj,scope.row.statis.jttdmj)}}
                </template>
              </el-table-column>
              <el-table-column label="预算金额（元）" align="center" prop="totalMoney">
                <template slot-scope="scope">
                  {{
                    scope.row.totalMoney == 0 ? "-" : (String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.totalMoney).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.totalMoney).split('.')[1].length < 2 ? String(scope.row.totalMoney).split('.')[1] + '0' : String(scope.row.totalMoney).split('.')[1]))
                  }}
                </template>
              </el-table-column>
            <!--  <el-table-column label="国有土地" align="center">
                <el-table-column
                  align="center"
                  prop="statis.gytdmj"
                  label="面积（亩）"
                  width="120">
                  <template slot-scope="scope">
                    <div>{{ scope.row.statis.gytdmj == 0 ? "-" : scope.row.statis.gytdmj }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="statis.gytdprice"
                  label="价格（元）"
                  width="120">
                  <template slot-scope="scope">
                    <div>
                      {{
                        scope.row.statis.gytdprice == 0 ? "-" : (String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                      }}
                    </div>
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column label="集体土地" align="center">
                <el-table-column
                  align="center"
                  prop="statis.jttdmj"
                  label="面积（亩）"
                  width="120">
                  <template slot-scope="scope">
                    <div>{{ scope.row.statis.jttdmj == 0 ? "-" : scope.row.statis.jttdmj }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="statis.jttdprice"
                  label="价格（元）"
                  width="120">
                  <template slot-scope="scope">
                    <div> {{
                        scope.row.statis.jttdprice == 0 ? "-" : (String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                      }}
                    </div>
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column label="附着物" align="center">
                <el-table-column
                  align="center"
                  prop="statis.qmmj"
                  label="面积（亩）"
                  width="120">
                  <template slot-scope="scope">
                    <div>{{ scope.row.statis.qmmj == 0 ? "-" : scope.row.statis.qmmj }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="statis.qmprice"
                  label="价格（元）"
                  width="120">
                  <template slot-scope="scope">
                    <div style="line-height: 23px; text-align: left;" v-show="scope.row.statis.qmprice !=0">
                      {{
                        scope.row.statis.qmprice == 0 ? "-" : (String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
                      }}
                    </div>
                  </template>
                </el-table-column>
              </el-table-column>-->
              <el-table-column label="备注" min-width="270" align="center" prop="aa">
                <template slot-scope="scope">
                   <div align="left" v-if="scope.row.statis.gytdmj!=null&&scope.row.statis.gytdmj!=''"> {{"国有土地 （面积："+scope.row.statis.gytdmj +"金额："+
                   (scope.row.statis.gytdprice == 0 ? "-" : (String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.gytdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.gytdprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.gytdprice).split('.')[1].length < 2 ? String(scope.row.statis.gytdprice).split('.')[1] + "0" : String(scope.row.statis.gytdprice).split('.')[1])))+"）"}}</div>
                  <div align="left" v-if="scope.row.statis.jttdmj!=null&&scope.row.statis.jttdmj!=''"> {{'集体土地 （面积：'+scope.row.statis.jttdmj +" 金额："+
                  (scope.row.statis.jttdprice == 0 ? "-" : (String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.jttdprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.jttdprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.jttdprice).split('.')[1].length < 2 ? String(scope.row.statis.jttdprice).split('.')[1] + '0' : String(scope.row.statis.jttdprice).split('.')[1])))+"）"}}</div>
                    <div align="left" v-if="scope.row.statis.qmmj!=null&&scope.row.statis.qmmj!=''"> {{'青 苗  （面积：'+scope.row.statis.qmmj +' 金额：'+
                    (scope.row.statis.qmprice == 0 ? "-" : (String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.qmprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.qmprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.qmprice).split('.')[1].length < 2 ? String(scope.row.statis.qmprice).split('.')[1] + '0' : String(scope.row.statis.qmprice).split('.')[1])))+"）"}}</div>
                  <div align="left" v-if="scope.row.statis.fswmj!=null&&scope.row.statis.fswmj!=''"> {{'地上附属物  （面积：'+scope.row.statis.fswmj +' 金额：'+
                    (scope.row.statis.fswprice == 0 ? "-" : (String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.statis.fswprice).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.statis.fswprice).split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + "." + (String(scope.row.statis.fswprice).split('.')[1].length < 2 ? String(scope.row.statis.fswprice).split('.')[1] + '0' : String(scope.row.statis.fswprice).split('.')[1])))+"）"}}</div>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <pagination
            v-show="pghztotal>0"
            :total="pghztotal"
            :page.sync="querypghzParams.pageNum"
            :limit.sync="querypghzParams.pageSize"
            @pagination="getPghzList"
          />
        </el-tab-pane>
      </el-tabs>

    </el-dialog>
    <!--    镇预算明细-->
    <el-dialog title="预算明细" :visible.sync="opencbfYsmx" width="1000px" append-to-body>
      <el-form :model="querybudgetFundsParams" ref="querybudgetFundsForm" :inline="true" v-show="showSearch">
        <el-form-item label="村" prop="departmentCode">
          <el-select
            v-model="querybudgetFundsParams.departmentCode"
            clearable
            placeholder="请选择村"
            style="width: 120px"
          >
            <el-option
              v-for="item in this.villageData"
              :key="item.deptCode"
              :label="item.deptName"
              :value="item.deptCode">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="承包方" prop="cbfmc">
          <el-input
            v-model="querybudgetFundsParams.cbfmc"
            placeholder="请输入承包方"
            clearable
            size="small"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleDetailsQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetDetailsQuery">重置</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="loading" :data="detailsList" @selection-change="handleSelectionChange">
        <el-table-column width="220" label="行政区划" align="center" prop="county">
          <template slot-scope="scope">
            {{ scope.row.county }} - {{ scope.row.township }} - {{ scope.row.village }}
          </template>
        </el-table-column>
        <!--<el-table-column label="县区" align="center" prop="county"/>
        <el-table-column label="乡镇" align="center" prop="township"/>
        <el-table-column label="村" align="center" prop="village"/>-->
        <el-table-column label="承包方" align="center" prop="cbfmc"/>
        <el-table-column label="地块编码" align="center" prop="dkbm"/>
        <el-table-column label="附着物" align="center" prop="itemName"/>
        <el-table-column label="面积（亩）" align="center" prop="evaluationArea"/>
        <el-table-column label="评估价（元）" align="center" prop="price">
          <template slot-scope="scope">
            {{
              scope.row.price == 0 ? "-" : (String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.price).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
            }}
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="detailstotal>0"
        :total="detailstotal"
        :page.sync="querybudgetFundsParams.pageNum"
        :limit.sync="querybudgetFundsParams.pageSize"
        @pagination="getDetailsList"
      />
    </el-dialog>

    <el-dialog title="预算明细" :visible.sync="openYsmx" width="900px" append-to-body>
      <div style="min-height: 400px">
        <el-table v-loading="loadingYsmx" :data="detailsList">
          <el-table-column label="预算编号" width="200" align="center" prop="number"/>
          <el-table-column label="预算名称" align="center" prop="name"/>
          <el-table-column label="预算年份" width="80" align="center" prop="year"/>
          <el-table-column label="面积（亩）" width="90" align="center" prop="zmj"/>
          <el-table-column label="预算金额（元）" width="120" align="center" prop="totalMoney">
            <template slot-scope="scope">
              {{
                scope.row.totalMoney == 0 ? "-" : (String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,').split('.').length < 2 ? String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + ".00" : String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'))
              }}
            </template>
          </el-table-column>
          <el-table-column label="预算单位" width="120" align="center" prop="deptName"/>
        </el-table>
      </div>

      <pagination
        v-show="detailstotal>0"
        :total="detailstotal"
        :page.sync="querybudgetFundsParams.pageNum"
        :limit.sync="querybudgetFundsParams.pageSize"
        @pagination="getDetailsList"
      />
    </el-dialog>

    <el-dialog title="审核记录" :visible.sync="openShjl" width="800px" append-to-body>
      <div style="min-height: 484px">
        <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
          <el-table-column label="审核人" align="center" prop="personalName"/>
          <el-table-column label="审核时间" align="center" prop="approvingTime"/>
          <el-table-column label="审核状态" align="center" prop="state">
            <template slot-scope="scope">
              <div class="statusDv">
                <div class="statudPoint" :class="'Bg'+scope.row['state']"></div>
                <div v-for="sta in budgetStatus" v-if="sta.dictValue == scope.row['state']">{{ sta.dictLabel }}</div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="审核意见" align="center" prop="by1"/>
        </el-table>
      </div>
      <pagination
        v-show="recordtotal>0"
        :total="recordtotal"
        :page.sync="queryRecordParams.pageNum"
        :limit.sync="queryRecordParams.pageSize"
        @pagination="getRecordList"
      />
    </el-dialog>

    <el-dialog :title="'我的预算'" :visible.sync="openMyBudget" width="900px" append-to-body>
      <div style="min-height: 484px">
        <el-table v-loading="loading" :data="MyBudgetFundsList" @selection-change="handleSelectionChange">
          <el-table-column label="预算编号" width="200" align="center" prop="number"/>
          <el-table-column label="预算名称" align="center" prop="name"/>
          <el-table-column label="预算年份" align="center" prop="year"/>
          <el-table-column label="面积（亩）" align="center" prop="zmj"/>
          <el-table-column label="预算金额（元）" width="135" align="center" prop="totalMoney">
            <template slot-scope="scope">
              {{
                scope.row.totalMoney == 0 ? "-" : String(scope.row.totalMoney).replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
              }}
            </template>
          </el-table-column>
          <el-table-column label="预算单位" align="center" prop="deptName"/>
          <el-table-column label="审核状态" align="center" prop="state" :formatter="contractFormat"/>
        </el-table>
      </div>
      <pagination
        v-show="mytotal>0"
        :total="mytotal"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getMyList"
      />
    </el-dialog>

    <el-dialog title="操作日志" :visible.sync="openCzrz" width="1000px" append-to-body @close="cancel">
      <div style="min-height: 484px">
        <el-table v-loading="loading" :data="htczrzList">
          <el-table-column label="操作名称" align="center" prop="operName"/>
          <el-table-column label="操作人" align="center" prop="by1"/>
          <el-table-column label="操作时间" align="center" prop="createTime"/>
        </el-table>
      </div>
      <pagination
        v-show="htczrztotal>0"
        :total="htczrztotal"
        :page.sync="queryczrzParams.pageNum"
        :limit.sync="queryczrzParams.pageSize"
        @pagination="getCzrzList"
      />
    </el-dialog>
  </div>
</template>

<script>
import {
  addBudgetFunds,
  approval,
  approvalList,
  approvalMoney,
  childList,
  countyAdd,
  countyMoney,
  countySubmit,
  delBudgetFunds,
  deptList,
  exportMxList,
  getNumber,
  listMyBudgetFunds,
  mxList, operationLog,
  statis, statisForAddOrUpdate,
  subApprovalList,
  subList,
  updateBudgetFunds,
  verifyForAddOrUpdateTownship
} from "@/api/zjgl/budgetFunds";
import {childlistUse, getDept} from "@/api/system/dept";
import {getInfo} from "@/api/login";
import { Decimal } from 'decimal.js'


export default {
  name: "BudgetFunds",
  data() {
    return {
      openMyBudget: false,
      openCheck: false,
      openBudget: false,
      openYsmx: false,
      opencbfYsmx: false,
      openShjl: false,
      deptCode: '',
      budgetId: '',
      cityShow: '',
      townShow: '',
      villageShow: '',
      pgList: [],
      villageData: [],
      detailsList: [],
      pghzList: [],
      statusOptions: [],
      budgetStatus: [],
      approveStatus: [],
      villageSelectData: [],//选择村的数据
      openCzrz: false,
      htczrzList: [],
      htczrztotal: 0,
      activeCheck: 0,
      active: 0,
      // 遮罩层
      loading: false,
      newloading: false,
      loadingYsmx: false,
      // 选中数组
      ids: [],
      shList: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      pgtotal: 0,
      shtotal: 0,
      mytotal: 0,
      detailstotal: 0,//预算明细
      pghztotal: 0,//预算明细
      // 【请填写功能名称】表格数据
      recordList: [],
      recordtotal: 0,
      MyBudgetFundsList: [],
      cityData: [],
      townData: [],
      BudgetFundsList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      openTabYsmx: false,
      // 查询参数
      querypgParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        cbfmc: null,
        departmentCode: null,
      },
      queryczrzParams: {
        pageNum: 1,
        pageSize: 10,
        budgetIds: null,
      },
      queryShParams: {
        pageNum: 1,
        pageSize: 10,
        cbfmc: null,
        departmentCode: null,
      },
      querybudgetFundsParams: {
        pageNum: 1,
        pageSize: 10,
        budgetId: null,
        departmentCode: null,
        cbfmc: null,
        city: null,
        town: null,
        village: null,
      },
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        budgetId: null,
        name: null,
        year: null,
        sdate: null,
        edate: null,
        budgetpersonid: null,
        budgetperson: null,
        budgetmoney: null,
        submittime: null,
        number: null,
        remarks: null,
        status: null,
        approvedperson: null,
        approveddate: null,
        createtime: null,
        by1: null,
        by2: null,
        by3: null
      },
      queryRecordParams: {
        pageNum: 1,
        pageSize: 10,
      },
      queryczrzParams: {
        pageNum: 1,
        pageSize: 10,
        distributionIds: null,
      },
      querypghzParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        departmentCode: null,
        parentBudgetId: null,
      },
      yqhtje: '',
      xhtje: '',
      yszje: '',
      value1: [],
      value2: [],
      // 表单参数
      form: {},
      myform: {},
      // 表单校验
      rules: {
        year: [
          {required: true, message: "预算年度不能为空", trigger: "blur"}
        ],
        departmentCode: [
          {required: true, message: "预算单位不能为空", trigger: "blur"}
        ],
        name: [
          {required: true, message: "预算名称不能为空", trigger: "blur"}
        ],
        number: [
          {required: true, message: "预算编号不能为空", trigger: "blur"}
        ],
      }
    };
  },
  created() {
    this.getDicts('sys_normal_disable').then(response => {
      this.statusOptions = response.data
    })
    this.getDicts('sys_budget_status').then(response => {
      this.budgetStatus = response.data
    })
    this.getDicts('sys_approve_status').then(response => {
      this.approveStatus = response.data
    })

    this.getList();

    /*getInfo().then(response => {
      let deptCode = response.user.dept.deptCode;

      childlistUse(deptCode).then(response => {
        this.villageData = response.data;
      });
    });*/
  },
  methods: {
    getCzrzList() {
      this.loading = true;
      this.queryczrzParams.contractIds=this.ids;
      operationLog(this.queryczrzParams).then(response=> {
        this.loading = false;
        this.htczrzList=response.rows;
        this.htczrztotal=response.total;
      });
    },
    handleOperationLog(row) {
      const ids = row.budgetId || this.ids;
      this.ids=row.budgetId;
      this.queryczrzParams.budgetIds=ids;
      this.openCzrz=true;
      operationLog(this.queryczrzParams).then(response=> {
        this.htczrzList=response.rows;
        this.htczrztotal=response.total;
      });
    },
    getAddPghzList() {
      statisForAddOrUpdate(
        this.villageSelectData,
        this.form.year,
        this.ids,
        this.querypghzParams.pageNum,
        this.querypghzParams.pageSize
      ).then(response => {
        this.pghzList = response.rows;
        this.pghztotal = response.total;
        this.loading = false;
      });
    },
    getPghzList() {
      childList(
        this.querypghzParams.parentBudgetId,
        this.querypghzParams.pageNum,
        this.querypghzParams.pageSize
      ).then(response => {
        this.pghzList = response.rows;
        this.pghztotal = response.total;
        this.loading = false;
      });
    },
    // 选择县
    selectCity(val) {
      this.deptCode = val;
      this.city = val;
      if (val != "" && val != null) {
        childlistUse(val).then(response => {
          this.townData = response.data;
        });
      }
    },
    // 选择镇
    selectTown(val) {
      this.deptCode = val;
      this.town = val;
      if (val != "" && val != null) {
        childlistUse(val).then(response => {
          this.villageData = response.data;
        });
      }
    },
    // 选择村
    selectVillage(val) {
      this.deptCode = val;
      this.village = val;
    },
    checkboxT(row, rowIndex) {
      //
      if (row.parentId != "" && row.parentId != undefined) {
        return false;//禁用
      } else {
        return true;//不禁用
      }
    },
    selectDept(val) {
      this.villageSelectData = val;
      this.form.departmentCode = val.toString();
    },
    // 菜单状态字典翻译
    contractFormat(row, column) {
      return this.selectDictLabel(this.budgetStatus, row.state);
    },
    /** 查询【请填写功能名称】列表 */
    getList() {
      this.loading = true;
      listMyBudgetFunds(this.queryParams).then(response => {
        this.BudgetFundsList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
      /* listBudgetFunds(this.queryParams).then(response => {
         this.BudgetFundsList = response.rows;
         this.total = response.total;
         this.loading = false;
       });*/
    },
    getPgList() {
      this.querypgParams.regionCodes = this.villageSelectData;
      subList({
        regionCodes: this.villageSelectData,
        year: this.form.year,
        budgetId: this.budgetId
      }, this.querypgParams.pageNum, this.querypgParams.pageSize).then(response => {
        this.pgList = response.rows;
        this.pgtotal = response.total;
        this.loading = false;
      });
      /*


            subList({
              regionCodes: this.villageSelectData,
              year: this.queryParams.year,
              cbfmc: this.querypgParams.cbfmc,
              departmentCode: this.querypgParams.departmentCode
            }, this.querypgParams.pageNum, this.querypgParams.pageSize).then(response => {
              this.pgList = response.rows;
              this.pgtotal = response.total;
              this.loading = false;
            });*/
    },
    // 预算明细
    getDetailsList() {
      this.loadingYsmx = true;
      mxList(this.querybudgetFundsParams).then(response => {
        this.detailsList = response.rows;
        this.detailstotal = response.total;
        this.loadingYsmx = false;
      });
    },
    // 我的预算
    getMyList() {
      this.loadingYsmx = true;
      this.querybudgetFundsParams.budgetId = "";
      listMyBudgetFunds(this.querybudgetFundsParams).then(response => {
        this.MyBudgetFundsList = response.rows;
        this.mytotal = response.total;
        this.loadingYsmx = false;
      });
    },
    /*pres() {
      if (this.active-- > 2) this.active = 0;
    },
    next() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          let villageSelectData = this.villageSelectData;
          verifyForAddOrUpdateTownship({
            regionCodes: villageSelectData,
            year: this.form.year,
            budgetId: this.budgetId
          }).then(response => {
            if (response.code != 200) {
              this.msgError(response.msg);
              return false;
            }
            if (this.active++ > 2) this.active = 0;
            subList({
              regionCodes: villageSelectData,
              year: this.form.year,
              budgetId: this.budgetId
            }, this.querypgParams.pageNum, this.querypgParams.pageSize).then(response => {
              this.pgList = response.rows;
              this.pgtotal = response.total;
              this.loading = false;
            });
          });
          /!* if (this.active++ > 2) this.active = 0;
           subList({
             budgetId:this.ids,
             regionCodes: this.villageSelectData,
             year: this.queryParams.year
           }, this.querypgParams.pageNum, this.querypgParams.pageSize).then(response => {
             this.pgList = response.rows;
             this.pgtotal = response.total;
             this.loading = false;
           });*!/
        }
      });

    },*/
    pres() {
      let active = this.active - 1;
      if (active == 0) {
        this.active = 0;
      } else if (active == 1) {
        this.active = 1;
        subList({
          regionCodes: this.villageSelectData,
          year: this.form.year,
          budgetId: this.budgetId
        }, this.querypgParams.pageNum, this.querypgParams.pageSize).then(response => {
          this.pgList = response.rows;
          this.pgtotal = response.total;
          this.loading = false;
        });
      } else if (active == 2) {
        this.active = 2;
      } else {
        this.active = 0;
      }
    },
    next() {
      let active = this.active + 1;
      if (active == 1) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            if (active == 1) {
              this.active = 1;
            } else if (active == 2) {
              this.active = 2;
            } else if (active == 3) {
              this.active = 3;
            } else {
              this.active = 0;
            }
            //验证
            verifyForAddOrUpdateTownship({
              regionCodes: this.villageSelectData, year: this.form.year, budgetId: this.budgetId
            }).then(response => {
              if (response.code != 200) {
                this.msgError(response.msg);
                return false;
              }
              // if (this.active++ > 2) this.active = 0;
              subList({
                regionCodes: this.villageSelectData,
                year: this.form.year,
                budgetId: this.budgetId
              }, this.querypgParams.pageNum, this.querypgParams.pageSize).then(response => {
                this.pgList = response.rows;
                this.pgtotal = response.total;
                this.loading = false;
              });
            });
          }
        });
      } else {
        if (active == 1) {
          this.active = 1;
        } else if (active == 2) {
          this.active = 2;
          this.getAddPghzList();
          // this.getPghzList();
        } else if (active == 3) {
          this.active = 3;
        } else {
          this.active = 0;
        }
      }
    },
    /*getAddPghzList() {
      statis(this.ids).then(response => {
        this.pghzList = response.rows;
        this.pghztotal = response.total;
        this.loading = false;
        if (response.code == 200) {
          return false;
        }
      });
    },*/
    presCheck() {
      if (this.activeCheck-- > 2) this.activeCheck = 0;
    },
    nextCheck() {
      if (this.activeCheck++ > 2) this.activeCheck = 0;
    },
    nextspCheck() {
      if (this.activeCheck++ > 2) this.activeCheck = 0;
      this.form.state = this.approveStatus[0].dictValue;
      approvalMoney({budgetIds: this.ids}).then(response => {
        this.xhtje = response.data.xzhtje;
        this.yqhtje = response.data.yqhtje;
        this.yszje = response.data.yszje;
      });
    },
    submitFormsp() {
      approval({budgetIds: this.ids, state: this.form.state, by1: this.form.by1}).then(response => {
        if (this.form.state == "3" && (this.form.remark == "" || this.form.remark == undefined || this.form.remark == null)) {
          this.$message.warning("审核意见不可为空");
          return false;
        }
        if (response.code == "200") {
          this.msgSuccess("操作成功");
          this.openCheck = false;
          this.getList();
        } else {
          this.msgError(response.msg);
        }
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.active = 0
      this.activeCheck = 0
      this.reset();
      this.pgList = [];
    },
    cancelMy() {
      this.openBudget = false;
      this.reset();
    },
    cancelCheck() {
      this.openCheck = false;
      this.activeCheck = 0
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        budgetId: null,
        name: null,
        state: null,
        year: null,
        sdate: null,
        edate: null,
        budgetpersonid: null,
        budgetperson: null,
        budgetmoney: null,
        submittime: null,
        number: null,
        departmentCode: null,
        departmentName: null,
        remarks: null,
        status: "0",
        approvedperson: null,
        approveddate: null,
        createtime: null,
        by1: null,
        by2: null,
        by3: null
      };
      this.myform = {
        budgetId: null,
        name: null,
        year: null,
        sdate: null,
        edate: null,
        budgetpersonid: null,
        budgetperson: null,
        budgetmoney: null,
        submittime: null,
        number: null,
        departmentCode: null,
        remarks: null,
        status: "0",
        approvedperson: null,
        approveddate: null,
        createtime: null,
        totalMoney: null,
        by2: null,
        by3: null
      };
      this.resetForm("form");
      this.resetForm("myform");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams.year = "";
      this.handleQuery();
    },
    handlePgQuery() {
      this.querypgParams.pageNum = 1;
      this.getPgList();
    },
    /** 重置按钮操作 */
    resetShQuery() {
      this.queryShParams.cbfmc = "";
      this.queryShParams.departmentCode = "";
      this.resetForm("queryShParams");
      this.handleShQuery();
    },
    handleShQuery() {
      this.queryShParams.pageNum = 1;
      this.queryShParams.departmentCode = this.deptCode;
      this.getApprovalList();
    },
    /** 重置按钮操作 */
    resetPgQuery() {
      this.querypgParams.cbfmc = "";
      this.resetForm("querypgForm");
      this.handlePgQuery();
    },

    handleDetailsQuery() {
      this.querybudgetFundsParams.pageNum = 1;
      this.querybudgetFundsParams.departmentCode = this.deptCode;
      this.getDetailsList();
    },
    /** 重置按钮操作 */
    resetDetailsQuery() {
      this.resetForm("querybudgetFundsForm");
      this.deptCode = "";
      this.handleDetailsQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.budgetId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "新增";
      getNumber().then(response => {
        this.form.number = response.msg;
      });
      getInfo().then(response => {
        let deptCode = response.user.deptId;
        getDept(deptCode).then(response => {
          this.form.name = response.data.deptName + "预算";
        });
      });

      deptList().then(response => {
        this.villageData = response.data;
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.open = true;
      this.title = "修改";
      this.reset();
      const budgetId = row.budgetId;
      this.querypghzParams.parentBudgetId = budgetId;
      getInfo().then(response => {
        let deptCode = response.user.dept.deptCode;

        if (deptCode.length == 4) {//新区
          this.cityShow = true;
          this.townShow = true;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.cityData = response.data;
          });
        } else if (deptCode.length == 6) {//县
          this.cityShow = false;
          this.townShow = true;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.townData = response.data;
          });
        } else if (deptCode.length == 9) {//镇
          this.cityShow = false;
          this.townShow = false;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.villageData = response.data;
          });
        } else if (deptCode.length == 12) {//村
          this.cityShow = false;
          this.townShow = false;
          this.villageShow = false;
        } else {
          this.childlist(1306);
          this.cityShow = true;
          this.townShow = true;
          this.villageShow = true;
        }
      });
      this.budgetId = budgetId;
      if (row.by3 != null && row.by3 != undefined && row.by3 != "") {
        let departmentCode = row.by3.split(",");
        this.form.departmentName = departmentCode;
        this.form.departmentCode = departmentCode;
        this.villageSelectData = departmentCode;
      }
      let year = row.year;
      let name = row.name;
      let number = row.number;
      let remark = row.remark;
      this.form.year = year;
      this.form.number = number;
      this.form.remark = remark;
      this.form.name = name;
      this.form.budgetId = budgetId;
      this.ids = budgetId;

      /*getBudgetFunds(id).then(response => {
        this.form = response.data;
        this.title = "修改";
      });*/
    },
    /** 提交按钮 */
    submitForm() {
      if (this.pgList == [] || this.pgList == undefined) {
        this.$message.warning("没有数据");
        return false;
      }
      this.form.state = "0";
      if (this.form.budgetId != null) {
        this.form.regionCodes = this.villageSelectData;
        this.form.departmentCode = this.form.departmentCode.toString();
        updateBudgetFunds(this.form).then(response => {
          this.msgSuccess("修改成功");
          this.open = false;
          this.getList();
          this.pgList = [];
        });
      } else {
        this.form.departmentCode = "";
        this.form.regionCodes = this.villageSelectData;
        addBudgetFunds(this.form).then(response => {

          this.msgSuccess("新增成功");
          this.open = false;
          this.getList();
          this.pgList = [];
        });
      }
    },
    submitBudgetFundsForm() {
      this.$refs["myform"].validate(valid => {
        if (valid) {
          this.myform.budgetIds = this.ids;
          countyAdd(this.myform).then(response => {
            this.msgSuccess("操作成功");
            this.openBudget = false;
            this.getList();
          });
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.budgetId || this.ids;
      this.$confirm('是否确认删除数据项?', "警告", {
        cancelButtonClass: 'btn-custom-cancel',
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return delBudgetFunds(ids);
      }).then(() => {
        this.getList();
        this.msgSuccess("删除成功");
      })
    },
    handleCheck() {
      this.openCheck = true
      //获取明细信息
      this.getApprovalList();
      /*subApprovalList({budgetIds: this.ids}, this.queryShParams.pageNum, this.queryShParams.pageSize).then(response => {
        this.pgList = response.rows;
        this.pgtotal = response.total;
        this.loading = false;
      });*/
      getInfo().then(response => {
        let deptCode = response.user.dept.deptCode;
        this.deptCode = deptCode;
        if (deptCode.length == 4) {//新区
          this.cityShow = true;
          this.townShow = true;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.cityData = response.data;
          });
        } else if (deptCode.length == 6) {//县
          this.cityShow = false;
          this.townShow = true;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.townData = response.data;
          });
        } else if (deptCode.length == 9) {//镇
          this.cityShow = false;
          this.townShow = false;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.villageData = response.data;
          });
        } else {
          this.childlist(1306);
          this.cityShow = true;
          this.townShow = true;
          this.villageShow = true;
        }
      });
    },

    sumTotal(a,b){
      return new Decimal(a).add(new Decimal(b));
    },
    handlecbfDetails(row) {
      this.opencbfYsmx = true;
      this.querybudgetFundsParams.budgetId = row.budgetId;
      //获取明细信息
      this.getDetailsList();
      getInfo().then(response => {
        let deptCode = response.user.dept.deptCode;

        if (deptCode.length == 4) {//新区
          this.cityShow = true;
          this.townShow = true;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.cityData = response.data;
          });
        } else if (deptCode.length == 6) {//县
          this.cityShow = false;
          this.townShow = true;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.townData = response.data;
          });
        } else if (deptCode.length == 9) {//镇
          this.cityShow = false;
          this.townShow = false;
          this.villageShow = true;
          childlistUse(deptCode).then(response => {
            this.villageData = response.data;
          });
        } else if (deptCode.length == 12) {//村
          this.cityShow = false;
          this.townShow = false;
          this.villageShow = false;
        } else {
          this.childlist(1306);
          this.cityShow = true;
          this.townShow = true;
          this.villageShow = true;
        }
      });
    },
    handleSubmit(row) {
      this.$confirm('是否提交至审核人员审核?', '提示', {
        cancelButtonClass: 'btn-custom-cancel',
        confirmButtonText: '是',
        cancelButtonText: '否',
        type: 'warning'
      }).then(() => {
        if (row.budgetId != null) {
          this.form.budgetId = row.budgetId;
          countySubmit(this.form).then(response => {
            this.msgSuccess("提交成功");
            this.getList();
            this.pgList = [];
          });
        }
      }).catch(() => {
      })
    },
    handleTabDetails(row) {
      let deptCode = row.departmentCode;
      if (deptCode.length == 4) {//新区
        this.cityShow = true;
        this.townShow = true;
        this.villageShow = true;
        childlistUse(deptCode).then(response => {
          this.cityData = response.data;
        });
      } else if (deptCode.length == 6) {//县
        this.cityShow = false;
        this.townShow = true;
        this.villageShow = true;
        childlistUse(deptCode).then(response => {
          this.townData = response.data;
        });
      } else if (deptCode.length == 9) {//镇
        this.cityShow = false;
        this.townShow = false;
        this.villageShow = true;
        childlistUse(deptCode).then(response => {
          this.villageData = response.data;
        });
      } else if (deptCode.length == 12) {//村
        this.cityShow = false;
        this.townShow = false;
        this.villageShow = false;
      } else {
        this.childlist(1306);
        this.cityShow = true;
        this.townShow = true;
        this.villageShow = true;
      }
      this.openTabYsmx = true;
      this.querybudgetFundsParams.budgetId = row.budgetId;
      this.querypghzParams.parentBudgetId = row.budgetId;
      //获取明细信息
      this.getDetailsList();
      this.getPghzList();
    },
    handleDetails(row) {
      this.openYsmx = true;
      this.querybudgetFundsParams.budgetId = row.budgetId;
      //获取明细信息
      this.getDetailsList();
    },
    handleExamineRecord(row) {
      this.openShjl = true;
      this.querybudgetFundsParams.budgetId = row.budgetId;
      //获取明细信息
      approvalList({
        budgetId: row.budgetId,
        pageNum: this.queryRecordParams.pageNum,
        pageSize: this.queryRecordParams.pageSize
      }).then(response => {
        this.recordList = response.rows;
        this.recordtotal = response.total;
      });
    },
    getApprovalList() {
      subApprovalList({
        budgetIds: this.ids,
        cbfmc: this.queryShParams.cbfmc,
        departmentCode: this.queryShParams.departmentCode
      }, this.queryShParams.pageNum, this.queryShParams.pageSize).then(response => {
        this.shList = response.rows;
        this.shtotal = response.total;
        this.loading = false;
      });
    },
    getRecordList() {
      approvalList({
        budgetId: this.querybudgetFundsParams.budgetId,
        pageNum: this.queryRecordParams.pageNum,
        pageSize: this.queryRecordParams.pageSize
      }).then(response => {
        this.recordList = response.rows;
        this.recordtotal = response.total;
      });
    },
    handleBudget() {
      this.reset();
      countyMoney({budgetIds: this.ids}).then(response => {
        if (response.code == "500") {
          return false;
        }
        this.myform.totalMoney = response.data.yszje;
      });
      this.openBudget = true;
      this.title = "生成预算";
      getNumber().then(response => {
        this.myform.number = response.msg;
      });
      getInfo().then(response => {
        // deptCode = response.user.dept.deptCode;
        let deptCode = response.user.deptId;
        getDept(deptCode).then(response => {
          this.myform.name = response.data.deptName + "预算";
        });
      });
    },
    handleMyBudget() {
      this.openMyBudget = true;
      this.getMyList();
    },
    /** 导出按钮操作 */
    handleExport() {
      const ids = this.ids;
      let _this = this;
      this.$confirm('是否确认导出?', "警告", {
        cancelButtonClass: 'btn-custom-cancel',
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        _this.newloading = _this.$loading({
          lock: true,
          text: 'Loading',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        });
        return exportMxList({budgetIds: ids.toString()});
      }).then(response => {
        _this.newloading.close();
        this.download(response.msg);
      })
    }
  }
};
</script>
<style>
.btn-custom-cancel {
  float: right;
  margin-left: 10px;
}

.selectedDv {
  background-color: rgba(230, 247, 255, 1);
  box-sizing: border-box;
  border-width: 1px;
  border-style: solid;
  border-color: rgba(186, 231, 255, 1);
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
}

.statusDv {
  display: flex;
  justify-content: center;
  align-items: center;
}

.statudPoint {
  border-radius: 50px;
  width: 6px;
  height: 6px;
  margin-right: 6px;
}

/*审核通过背景色*/
.Bg2 {
  background-color: #13ce66;
}

/*未提交*/
.Bg0 {
  background-color: #1890ff;
}

/*待审核*/
.Bg1 {
  background-color: orange;
}

/*审核失败*/
.Bg3 {
  background-color: red;
}
</style>
